
#include "loop_epollserver.hpp"
#include "Calculator.hpp"
#include "protocal.hpp"

std::string OnMessage(std::shared_ptr<Connection> con_ptr)
{
    static Calculator cal;

    std::string &inbuffer = con_ptr->Inbuffer();
    std::string ret = cal(inbuffer);
    
    return ret;
}



int main(int argc , char* argv[])
{
    if(argc != 2)
    {
        exit(1);
    }

    uint16_t port = std::stoi(argv[1]);
    std::shared_ptr<Loop_Epollserver> svr = std::make_shared<Loop_Epollserver>(port , OnMessage);

    svr->Init();
    svr->Run();

    return 0;
}